package com.hisense.proxy.busitrans.aop;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hisense.proxy.busitrans.vo.BaseResponse;

public class BaseController {
	
	
	
	@ExceptionHandler
	@ResponseBody
	public BaseResponse handleAndReturnData(HttpServletRequest request, HttpServletResponse response, Exception ex) {
			
		return new BaseResponse().setError(ex.getMessage());
	}
	
	
	 protected BaseResponse getSuccessResponse() {
	        return new BaseResponse().setOk().setMessage("OK");
	    }

	    protected BaseResponse getFailResponse() {
	        return new BaseResponse().setError("");
	    }


}
